#include<iostream>
using namespace std;
class Plane    //飞机类
{
private:
    float wing;        //机翼长度
    float body;        //机身长度
    float tail;        //尾翼长度
    float voyage;      //航程
    int guest;         //旅客人数
public:
    Plane(float w, float b, float t, float v, int n) {
        wing = w;
        body = b;
        tail = t;
        voyage = v;
        guest = n;
    }
//你的代码将被嵌在这里
    virtual void display()
    {
        cout<<"Plane:\twing:"<<wing<<" body:"<<body<<" tail:"<<tail<<" voyage:"<<voyage<<" guest:"<<guest<<endl;
    }

};



class Fighter:virtual public Plane
{
private:
    int missile;
public:
    Fighter(float w,float b,float t,float v,int n,int m):
    Plane(w,b,t,v,n),missile(m)
    {}
    void fight()
    {
        cout<<"Fight!"<<endl;
    }
    virtual void display()
    {
        cout<<"This is a fighter!"<<endl;
        Plane::display();
        cout<<"missile:"<<missile<<endl;
    }
};


class Bomber :virtual public Plane
{
private:
    int bomb;
public:
    Bomber(float w,float b,float t,float v,int n,int m):
    Plane(w,b,t,v,n),bomb(m)
    {}
    void attack()
    {
        cout<<"Attack!"<<endl;
    }
    virtual void display()
    {
        cout<<"This is a bomber!"<<endl;
        Plane::display();
        cout<<"bomb:"<<bomb<<endl;
    }
    void getbomb()
    {
        cout<<"bomb:"<<bomb<<endl;
    }
};


class Fighter_Bomber:public Fighter,public Bomber
{
public:
    Fighter_Bomber(float w,float b,float t,float v,int n,int m,int k):
            Plane(w,b,t,v,n),Fighter(w,b,t,v,n,m),Bomber(w,b,t,v,n,k){}
    virtual void display()
    {
        cout<<"This is a fighter_bomber!"<<endl;
        Fighter::display();
        getbomb();
    }
};

    int main()
    {
        Plane *p;
        Fighter f(10.0,6.0,2.5,1800,1,8);             //歼击机
        Bomber b(30,9,6,12000,12,6000);             //轰炸机
        Fighter_Bomber fb(20,7,3.2,4000,2,6,2500);    //歼轰机
        p=&f;
        cout<<"********p=&f"<<endl;
        p->display();
        p=&b;
        cout<<"\n********p=&b"<<endl;
        p->display();
        p=&fb;
        cout<<"\n********p=&fb"<<endl;
        p->display();
        return 0;
    }




